<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>创新与管理国际学术会议-论文管理系统</title>

<!-- CSS -->
<link href="<%=request.getContextPath()%>/style/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/style/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/style/ie7.css" /><![endif]-->

<link href="<%=request.getContextPath()%>/style/uploadify/default.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/style/uploadify/uploadify.css" rel="stylesheet" type="text/css" />

<link href="<%=request.getContextPath()%>/style/submit.css" rel="stylesheet" type="text/css" media="screen" />
     
<!-- JavaScripts-->
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jNice.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/swfobject.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.json-2.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.validate.js"></script>

</head>

<body>
	<div id="wrapper">
    	<!-- 导航 -->
		<s:include value="../header.jsp">
			<s:param name="channel" value="1"/>
		</s:include>
        
        <div id="containerHolder">
			<div id="container">
				<!-- 左边菜单 -->
        		<s:include value="menu.jsp">
        			<s:param name="item" value="-1"/><!-- 在menu中没有 -->
        		</s:include>
                
                <!-- h2 stays for breadcrumbs -->
                <h2>论文管理 &raquo; <span class="active">修改论文 </span></h2>

                <div id="main">
                   	<h3>论文上传</h3>
                   	<div id="uploadForm">
                   		<div id="uploadTip">如果需要修改论文文件，请选择您修改后的论文进行上传；否则不需要重新上传:</div>
                       	<div id="fileQueue"></div>
						<div id="choosePannel" style="display:none">
							<input type="file" name="file" id="uploadify" />
						</div>
						<div id="fileInfo">
							<s:property value="paper.id"/>.doc 若要更改文件，请点击这里<a href="javascript:delFile()">修改</a>
						</div>
					</div>

                	<form action="update_paper.action" id="submitForm" class="jNice" method="post" onsubmit="$('#submitForm').valid()">
 						<input type="hidden" name="tmpFileName" value="" id="tmpFileName" />
 						<input type="hidden" name="pid" value="<s:property value="paper.id" />" />
						<h3>论文信息</h3>
                    	<fieldset>
                        	<p><label>中文标题:</label><input type="text" class="text-long" name="chineseTitle"  value="<s:property value="paper.chineseTitle" />" /></p>
                        	<p><label>英文标题:</label><input type="text" class="text-long" name="englishTitle" value="<s:property value="paper.englishTitle" />" /></p>
                            <p><label>论文页数:</label><input type="text" class="text-small" name="pageCount" value="<s:property value="paper.pageCount" />" /></p>
                            <p><label>论文主题:</label>
                            <select name="topicId" >
                            	<option value="0" <s:if test="paper.topicId == 0">selected="true"</s:if>>请选择主题</option>
                            	<option value="1" <s:if test="paper.topicId == 1">selected="true"</s:if>>产学研合作与战略联盟</option>
                            	<option value="2" <s:if test="paper.topicId == 2">selected="true"</s:if>>开放创新与分布式创新</option>
                            	<option value="3" <s:if test="paper.topicId == 3">selected="true"</s:if>>环境创新与可持续发展</option>
                            	<option value="4" <s:if test="paper.topicId == 4">selected="true"</s:if>>产品创新、产业创新与区域创新</option>
                            	<option value="5" <s:if test="paper.topicId == 5">selected="true"</s:if>>组织创新、制度创新与管理创新</option>
                                <option value="6" <s:if test="paper.topicId == 6">selected="true"</s:if>>科技政策、知识产权与知识管理</option>
                                <option value="7" <s:if test="paper.topicId == 7">selected="true"</s:if>>生产运作创新与IT技术应用</option>
                                <option value="8" <s:if test="paper.topicId == 8">selected="true"</s:if>>独立学院（民办大学）的创新与管理</option>
                                <option value="9" <s:if test="paper.topicId == 9">selected="true"</s:if>>综合</option>
                            </select>
                            </p>
                        	<p><label>备注:</label><textarea rows="1" cols="1" name="demo" ><s:property value="paper.demo" /></textarea></p>
                        </fieldset>
                        <h3>作者信息</h3>
                        <fieldset>
                        	<p><label>第一作者中文名:</label><input type="text" class="text-long" name="firstAuthor" value="<s:property value="paper.firstAuthor" />" /></p>
                        	<p><label>第一作者英文名:</label><input type="text" class="text-long" name="firstAuthorEn" value="<s:property value="paper.firstAuthorEn" />" /></p>
                            <p><label>第一作者邮箱:</label><input type="text" class="text-long" name="firstEmail" value="<s:property value="paper.firstEmail" />" /></p>
                            <p><label>第二作者姓名:</label><input type="text" class="text-long" name="secondAuthor" value="<s:property value="paper.secondAuthor" />" /></p>
                            <p><label>第三作者姓名:</label><input type="text" class="text-long" name="thirdAuthor" value="<s:property value="paper.thirdAuthor" />" /></p>
                            <input type="submit" value="&nbsp;&nbsp;修&nbsp;&nbsp;改&nbsp;&nbsp;" />
                        </fieldset>
                    </form>
                </div>
                <!-- // #main -->
                
                <div class="clear"></div>
            </div>
            <!-- // #container -->
        </div>	
        <!-- // #containerHolder -->
        
        <p id="footer">powered by 武汉理工大学管理学院</p>
    </div>
    <!-- // #wrapper -->
    
    <script type="text/javascript">
    	var submited = false;   //用户提交操作标志
    	var uploaded = true;    //上传成功标志
    	function delFile(){
			if(uploaded){
				$('#fileInfo').html('');
				$('#fileInfo').hide();
				
				$('#tmpFileName').val('');
				$('#choosePannel').show();
				
				uploaded = false;
			}
    	}

    	function cancelFile(){
    		$('#fileInfo').html('<s:property value="paper.id" />.doc <a href="javascript:delFile()">修改</a>');
			
			$('#tmpFileName').val('');

			uploaded = true;

			
    	}
    	
		$(document).ready(function()
	        {
	        	//上传组件
	            $("#uploadify").uploadify({
	                'uploader': '<%=request.getContextPath()%>/swf/uploadify.swf',
	                'script': '<%=request.getContextPath()%>/util/uploadFile.action',
	                'wmode' : 'transparent',
	                'cancelImg': '<%=request.getContextPath()%>/images/cancel.png',
	                'sizeLimit': 3 * 1024 * 1024,
	                'fileExt': '*.doc',
	                'fileDesc': 'word文件(*doc)',
	                'queueID': 'fileQueue',
	                'fileDataName': 'file',    // 对应文件域的name
	                'buttonText': 'Choose Paper',
	                'auto': true,
	                'multi': false,
	                'onComplete': function(event, queueID, fileObj, response, data){
						var result = $.evalJSON(response);
						
						$('#tmpFileName').val(result.tmpFileName);
						$('#choosePannel').hide('fast');
						$('#fileInfo').html('文件: ' + fileObj.name + ' 上传成功！<a href="javascript:delFile();">删除</a> <a href="javascript:cancelFile();">取消修改</a>');
						$('#fileInfo').show('slow');
						uploaded = true;

						//如果用户已点了提交 ，则自动提交
						if(submited){
							$('#submitForm').submit();
						}
	                }
	            });

	            //表单验证
	            $('#submitForm').validate({
	                rules: {
	                    chineseTitle: {
	                        maxlength: 50,
	                        required: true
	                    }
	                },
	                messages: {
	                	chineseTitle: {
	                        maxlength: '中文标题长度不能超过50字',
	                        required: '中文标题不能为空'
	                    }
	                }
	            });
	        });
	</script>

</body>

</html>